//using SqlSugar;

namespace Model
{
    /// <summary>
    /// 
    /// </summary>
    /// 
    [SqlSugar.SugarTable("MeterRead")]
    [PropertyChanged.AddINotifyPropertyChangedInterface]
    public class F_Water
    {
        /// <summary>
        /// 
        /// </summary>
        public F_Water()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// 
        [SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
        public System.Int32 Id { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.String MeterType { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.Int32 RoomId { get; set; }
        public System.Int32? BuildId { get; set; }
        public System.String BuildNo { get; set; }
        public System.String RoomNo { get; set; }
        public System.String Owner { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.Decimal? PreDegrees { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.Decimal? CurDegrees { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.DateTime? PreReadTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.DateTime? CurReadTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.Int32? CommunityId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.String State { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public System.String Remark { get; set; }
        public bool IsCharged { get; set; }
        public decimal Price { get; set; }

        //[Newtonsoft.Json.JsonIgnore()]
        //[RestSharp.Serializers.SerializeAs()]
        [SqlSugar.SugarColumn(IsIgnore =true)]
        public Rooms RoomInfo { get; set; }
        [SqlSugar.SugarColumn(IsIgnore = true)]
        public decimal? YingJiaoAmount 
        {
            get
            {
                return (CurDegrees - PreDegrees) * Price;
            }
        
        }

        DataContext context = new DataContext();

        [SqlSugar.SugarColumn(IsIgnore = true)]
        public F_CostRoom CostInfo 
        {
            get
            {
               var cost= context.DB.Queryable<F_CostRoom>().Where(c => c.WaterId == Id).First();
                if (cost !=null)
                {
                    
                }
                return cost;
            }
             
        }
       
    }
}